#pragma once
#include <ltbasedefs.h>
#include <Windows.h>



enum SOUND_TYPE
{
	SOUND_TYPE_3D =0,
	SOUND_TYPE_AMBIENT,
	SOUND_TYPE_LOCAL,
};
class speaker
{
public:
	speaker();

	speaker(const char* filename);

	void set_type(SOUND_TYPE _type);

	void set_loop(bool _loop)
	{if(_loop)m_sound_info.m_dwFlags|=PLAYSOUND_LOOP;
	else m_sound_info.m_dwFlags &=~PLAYSOUND_LOOP;}

	void set_priority(int _pri)
	{m_sound_info.m_nPriority=_pri;}

	void set_out_radius(float _out)
	{m_sound_info.m_fOuterRadius=_out;}

	void set_in_radius(float _in)
	{m_sound_info.m_fInnerRadius=_in;}

	void set_position(const LTVector& _pos)
	{m_sound_info.m_vPosition=_pos;}

	void set_volume(int _vo)
	{if(_vo<0||_vo>100)m_sound_info.m_nVolume=50;
	else m_sound_info.m_nVolume=_vo;}

	void set_interval(int _secends){m_update_ticks=_secends;}

	void play_sound();

	bool is_done();

	void close_sound();

	void update_volume();
	
private:
	void init();
	PlaySoundInfo m_sound_info;
	HLTSOUND  m_sound_handle;
	DWORD m_ticks;
	DWORD m_update_ticks;

	
};